package days48;
import java.util.ArrayList;
import java.util.Scanner;

public class day43{
    static ArrayList<ArrayList<Integer>> res = new ArrayList<ArrayList<Integer>>();
    static ArrayList<Integer> list = new ArrayList<>();
    public static void main1(String[] args){
        Scanner sc = new Scanner(System.in);
        int n, m;

        while(sc.hasNext()) {
            n = sc.nextInt();
            m = sc.nextInt();
            dfs(1, m, n);
            for(ArrayList<Integer> l : res) {
                int i = 0;
                for(; i < l.size() - 1; i++) {
                    System.out.print(l.get(i) + " ");
                }
                System.out.print(l.get(i)+" ");
            }
        }
    }

    private static void dfs(int i, int m, int n) {
        if(m == 0){
            res.add(new ArrayList<>(list));
        }else {
            for (int j = i; j <= m && j<= n ; j++) {
                list.add(j);
                dfs(i+1 , m-j ,n);
                list.remove(list.size()-1);
            }
        }
    }

    public static void main(String[] args) {

    }

}